/*
 Copyright (c) Jack魏 2023 - 2024, All Rights Reserved.

 Source Server         : 127.0.0.1
 Source Server Type    : MySQL
 Source Server Version : 80300 (8.3.0)
 Source Host           : localhost:3306
 Source Schema         : yiyi-web

 Target Server Type    : MySQL
 Target Server Version : 80300 (8.3.0)
 File Encoding         : 65001

 Date: 28/07/2024 15:57:42
*/

SET NAMES utf8mb4;
SET
FOREIGN_KEY_CHECKS = 0;

-- ----------------------------
-- Table structure for sys_login
-- ----------------------------
DROP TABLE IF EXISTS `sys_login`;
CREATE TABLE `sys_login`
(
    `id`          bigint unsigned NOT NULL AUTO_INCREMENT COMMENT 'id',
    `user_id`     bigint                                                       DEFAULT NULL COMMENT '用户id',
    `token`       varchar(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci NOT NULL COMMENT 'token值',
    `ip`          varchar(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci   DEFAULT NULL COMMENT '登陆ip',
    `status`      tinyint                                                      DEFAULT '1' COMMENT '状态：1正常，2长时间未操作，-1正常退出，-2强制退出',
    `os`          varchar(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci   DEFAULT NULL COMMENT '客户端类型',
    `browser`     varchar(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci   DEFAULT NULL COMMENT '浏览器',
    `ip_city`     varchar(64) CHARACTER SET utf8mb3 COLLATE utf8mb3_general_ci DEFAULT NULL COMMENT 'ip城市',
    `expire_time` datetime                                                     DEFAULT NULL COMMENT '过期时间',
    `update_time` datetime                                                     DEFAULT NULL COMMENT 'token刷新时间',
    `create_time` datetime                                                     DEFAULT NULL COMMENT '创建时间',
    PRIMARY KEY (`id`, `token`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COMMENT='系统登陆表';

-- ----------------------------
-- Records of sys_login
-- ----------------------------
BEGIN;
COMMIT;

-- ----------------------------
-- Table structure for sys_user
-- ----------------------------
DROP TABLE IF EXISTS `sys_user`;
CREATE TABLE `sys_user`
(
    `id`          bigint unsigned NOT NULL COMMENT '唯一用户id（雪花算法）',
    `account`     varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci NOT NULL COMMENT '账号（登录唯一用户名）',
    `password`    varchar(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci    DEFAULT NULL COMMENT '密码',
    `user_name`   varchar(32) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci  DEFAULT NULL COMMENT '用户名称（昵称）',
    `head_image`  varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci DEFAULT NULL COMMENT '头像',
    `email`       varchar(64) CHARACTER SET latin1 COLLATE latin1_swedish_ci    DEFAULT NULL COMMENT '邮箱',
    `phone`       varchar(32) CHARACTER SET latin1 COLLATE latin1_swedish_ci    DEFAULT NULL COMMENT '手机号',
    `sex`         tinyint                                                       DEFAULT NULL COMMENT '性别：0女，1男',
    `status`      tinyint                                                       DEFAULT '0' COMMENT '状态：0正常，1禁用',
    `notes`       varchar(500) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL COMMENT '备注',
    `is_del`      tinyint                                                       DEFAULT '0' COMMENT '是否删除',
    `update_time` datetime                                                      DEFAULT NULL COMMENT '修改时间',
    `create_time` datetime                                                      DEFAULT NULL COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC COMMENT='系统用户表';

-- ----------------------------
-- Records of sys_user
-- ----------------------------
BEGIN;
INSERT INTO `sys_user` (`id`, `account`, `password`, `user_name`, `head_image`, `email`, `phone`, `sex`, `status`,
                        `notes`, `is_del`, `update_time`, `create_time`)
VALUES (88888888, 'admin', '$2a$12$RoDTM9v5GxvJYYlS6w28FOoJKk7OhovrTI/QLMbi1kTwKHWimxHaO', 'Jack魏', 'jack.png',
        '888@qq.com', '18888889999', 1, 0, NULL, 0, '2024-06-06 06:06:06', '2024-03-03 18:18:18');
COMMIT;

-- ----------------------------
-- Table structure for sys_page
-- ----------------------------
DROP TABLE IF EXISTS `sys_page`;
CREATE TABLE `sys_page`
(
    `id`          int UNSIGNED NOT NULL AUTO_INCREMENT COMMENT '页面id',
    `group`       varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '分组',
    `name`        varchar(64) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '页面名称',
    `type`        tinyint NULL DEFAULT NULL COMMENT '权限类型：目录 1，菜单 2，按钮 3',
    `url`         varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT 'URL路径',
    `component`   varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '组件',
    `permission`  varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '权限许可',
    `method`      varchar(20) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '访问方法',
    `sort`        int NULL DEFAULT NULL COMMENT '排序',
    `parent_id`   int NULL DEFAULT 0 COMMENT '父id',
    `icon`        varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci NULL DEFAULT NULL COMMENT '图标',
    `is_del`      tinyint NULL DEFAULT 0 COMMENT '是否删除：0正常，1删除',
    `update_time` datetime NULL DEFAULT NULL COMMENT '修改时间',
    `create_time` datetime NULL DEFAULT NULL COMMENT '创建时间',
    PRIMARY KEY (`id`) USING BTREE
) ENGINE = InnoDB AUTO_INCREMENT = 5 CHARACTER SET = utf8mb4 COLLATE = utf8mb4_general_ci COMMENT = '系统页面表' ROW_FORMAT = DYNAMIC;

-- ----------------------------
-- Records of sys_page
-- ----------------------------
INSERT INTO `sys_page`
VALUES (1, '系统管理', '系统管理', 1, NULL, 'sys', 'admin', 'get', 1, 0, NULL, 0, '2023-07-01 22:09:26',
        '2023-07-01 22:09:26');
INSERT INTO `sys_page`
VALUES (2, '系统管理', '用户管理', 2, 'sys/userView', 'sys', 'admin', 'get', 1, 1, NULL, 0, '2024-07-21 15:33:51',
        '2023-07-01 22:09:26');
INSERT INTO `sys_page`
VALUES (3, '系统管理', '页面管理', 2, 'sys/pageView', 'sys', 'admin', 'get', 2, 1, NULL, 0, '2024-07-21 15:31:47',
        '2023-07-01 22:09:26');
INSERT INTO `sys_page`
VALUES (4, '系统管理', '角色管理', 2, 'sys/roleView', 'sys', 'admin', 'get', 3, 1, NULL, 0, '2024-07-21 17:22:43',
        '2023-07-01 22:09:26');

SET
FOREIGN_KEY_CHECKS = 1;
